﻿<navigation:Page x:Class="DC_RackSLDE.vwtblAppSolution" 
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
           mc:Ignorable="d"
           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
                 
           xmlns:input="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input"
           xmlns:dataControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
           xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.DomainServices"
           xmlns:dataFormToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.DataForm.Toolkit" 
           xmlns:controlsToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
           xmlns:domain="clr-namespace:DC_RackSLDE"
         
           d:DesignWidth="640" d:DesignHeight="480"
           Title="App Solutions">

    <Grid x:Name="LayoutRoot">


        <!-- Get the data definitions up front -->
        <!-- Edit Query Name -->
        <!-- defined over in the DomainService (RIA implementation) on the web side -->
        <!-- **************************** -->
        <riaControls:DomainDataSource x:Name="dds"             
                                              AutoLoad="True"            
                                              QueryName="GetTblAppSolutions"   
                                              LoadSize="20"
                                              LoadingData="dds_LoadingData"
                                              SubmittedChanges="dds_SubmittedChanges"
                                                >

            <riaControls:DomainDataSource.DomainContext>
                <domain:tblAppSolution_DCRackDomainContext/>
            </riaControls:DomainDataSource.DomainContext>

            <!-- edit field name for group descriptor -->
            <!-- **************************** -->
            <riaControls:DomainDataSource.GroupDescriptors>
                <riaControls:GroupDescriptor PropertyPath="appsolName" />
            </riaControls:DomainDataSource.GroupDescriptors>

            <!-- edit propertypath name for filter descriptor -->
            <!-- **************************** -->
            <riaControls:DomainDataSource.FilterDescriptors>
                <riaControls:FilterDescriptor PropertyPath="appsolName"
                                               Operator="StartsWith" Value="{Binding ElementName=tableFilterBox, Path=Text}" />
            </riaControls:DomainDataSource.FilterDescriptors>
        </riaControls:DomainDataSource>

        <ScrollViewer x:Name="PageScrollViewer" Style="{StaticResource PageScrollViewerStyle}" Margin="0,0,0,-33">

            <!-- Busy Indicator -->
            <controlsToolkit:BusyIndicator 
            IsBusy="{Binding ElementName=dds, Path=IsBusy}"   
            >


                <!-- Content stack panel -->
                <!-- Comment start and stop of all of the stack panels -->
                <StackPanel x:Name="ContentStackPanel" 
                        Height="480" Width="640">

                    <!-- datacontrols panel -->
                    <StackPanel x:Name="spDataControls" 
                            Width="638" Height="440" 
                            Orientation="Horizontal">

                        <StackPanel x:Name="spDataGrid" Orientation="Vertical" Height="410" Width="311">
                            <!-- filterbox stack panel -->
                            <StackPanel x:Name="spFilterBox" Height="30" Width="311" Orientation="Horizontal" Margin="0,0,0,10">
                                <!-- change textblock to match filter descriptor -->
                                <!-- **************************** -->
                                <TextBlock Text=" Filter appsolName  " Height="28" Width="125" FontSize="12" />
                                <input:AutoCompleteBox x:Name="tableFilterBox" Width="180" Height="28" ValueMemberBinding="{Binding Name}" Margin="0,1" />
                                <!-- end filterbox stack panel -->
                            </StackPanel>




                            <dataControls:DataGrid x:Name="_dataGrid" Height="335" Width="310" AutoGenerateColumns="False" 
                                       ItemsSource="{Binding Data, ElementName=dds}" VerticalScrollBarVisibility="Auto" 
                                       AlternatingRowBackground="Beige" Margin="0" SelectionChanged="_dataGrid_SelectionChanged">

                                <!-- Load datagrid columns here, recommend Karl Shifflett Xaml toys -->
                                <!-- **************************** -->


                                <dataControls:DataGrid.Columns>
                                    <dataControls:DataGridTextColumn Header=" Key" Binding="{Binding appsolKey}" SortMemberPath="appsolKey" />

                                    <dataControls:DataGridTextColumn Header=" Client Key" Binding="{Binding appsolClientKey}" SortMemberPath="appsolClientKey" />

                                    <dataControls:DataGridTextColumn Header=" Name" Binding="{Binding appsolName}" SortMemberPath="appsolName" />

                                    <dataControls:DataGridTextColumn Header=" Comments" Binding="{Binding appsolComments}" SortMemberPath="appsolComments" />

                                    <dataControls:DataGridTextColumn Header=" Last Edit" Binding="{Binding appsolLastEdit}" SortMemberPath="appsolLastEdit" />

                                    <dataControls:DataGridTextColumn Header=" Last Update" Binding="{Binding appsolLastUpdate}" SortMemberPath="appsolLastUpdate" />

                                </dataControls:DataGrid.Columns>




                                <!-- **************************** -->
                                <!-- End of datagrid column specifications -->
                            </dataControls:DataGrid>
                            <dataControls:DataPager Source="{Binding Data, ElementName=dds}" PageSize="10" />

                            <!-- end datagrid stack panel-->
                        </StackPanel>

                        <StackPanel x:Name="spDataForm" Height="410" Width="319">
                            <!-- Change Data Header Name here -->
                            <!-- **************************** -->
                            <TextBlock Text="App Solution Details" Height="28" FontSize="12" FontWeight="Normal" />

                            <dataFormToolkit:DataForm x:Name="_dataForm" Height="371" Width="319" VerticalAlignment="Top" 
                               CommandButtonsVisibility="Commit,Cancel,Edit" AutoEdit="False" AutoCommit="False" CommitButtonContent="Commit" 
                               CancelButtonContent="Cancel" CurrentItem="{Binding SelectedItem, ElementName=_dataGrid}" 
                               HorizontalAlignment="Left" Margin="0,0,0,0" AutoGenerateFields="False">
                                <!-- Load dataform columns and templates here -->
                                <!-- **************************** -->


                                <dataFormToolkit:DataForm.EditTemplate>
                                    <DataTemplate>
                                        <Grid>
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="Auto" />
                                                <RowDefinition Height="Auto" />
                                                <RowDefinition Height="Auto" />
                                                <RowDefinition Height="Auto" />
                                                <RowDefinition Height="Auto" />
                                                <RowDefinition Height="Auto" />
                                            </Grid.RowDefinitions>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition />
                                            </Grid.ColumnDefinitions>

                                            <dataFormToolkit:DataField Grid.Row="0" Grid.Column="0" Label=" Key" LabelPosition="Auto">
                                                <TextBox Text="{Binding Path=appsolKey, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" HorizontalAlignment="Stretch" VerticalAlignment="Top" />
                                            </dataFormToolkit:DataField>

                                            <dataFormToolkit:DataField Grid.Row="1" Grid.Column="0" Label=" Client Key" LabelPosition="Auto">
                                                <TextBox Text="{Binding Path=appsolClientKey, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" HorizontalAlignment="Stretch" VerticalAlignment="Top" />
                                            </dataFormToolkit:DataField>

                                            <dataFormToolkit:DataField Grid.Row="2" Grid.Column="0" Label=" Name" LabelPosition="Auto">
                                                <TextBox Text="{Binding Path=appsolName, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" HorizontalAlignment="Stretch" VerticalAlignment="Top" />
                                            </dataFormToolkit:DataField>

                                            <dataFormToolkit:DataField Grid.Row="3" Grid.Column="0" Label=" Comments" LabelPosition="Auto">
                                                <TextBox Text="{Binding Path=appsolComments, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" HorizontalAlignment="Stretch" VerticalAlignment="Top" />
                                            </dataFormToolkit:DataField>

                                            <dataFormToolkit:DataField Grid.Row="4" Grid.Column="0" Label=" Last Edit" LabelPosition="Auto">
                                                <TextBox Text="{Binding Path=appsolLastEdit, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" HorizontalAlignment="Stretch" VerticalAlignment="Top" />
                                            </dataFormToolkit:DataField>

                                            <dataFormToolkit:DataField Grid.Row="5" Grid.Column="0" Label=" Last Update" LabelPosition="Auto">
                                                <TextBox Text="{Binding Path=appsolLastUpdate, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True, StringFormat=\{0:d\}}" HorizontalAlignment="Stretch" VerticalAlignment="Top" />
                                            </dataFormToolkit:DataField>

                                        </Grid>
                                    </DataTemplate>
                                </dataFormToolkit:DataForm.EditTemplate>



                                <!-- **************************** -->
                                <!-- end of dataform columns and templates -->
                            </dataFormToolkit:DataForm>
                            <!-- end data form stack panel -->
                        </StackPanel>
                        <!-- end details stack panel -->
                    </StackPanel>
                    <StackPanel x:Name="spActionButtons" Height="30" Orientation="Horizontal" Width="268" HorizontalAlignment="Left">
                        <Button Click="btnSubmit_Click" Content="Submit" Height="28" Name="btnSubmit" Width="65" />
                        <Button Click="btnExport_Click" Content="Export" Height="28" HorizontalAlignment="Left" Margin="0" Name="btnExport" Width="65" />
                        <Button Click="btnCreate_Click" Content="Create" Height="28" Name="btnCreate" Width="65" />
                        <Button Click="btnDelete_Click" Content="Delete" Height="28" HorizontalAlignment="Left" Margin="0" Name="btnDelete" Width="65" />
                        <!-- end action buttons panel-->
                    </StackPanel>


                    <!-- End Content Stack Panel -->
                </StackPanel>

            </controlsToolkit:BusyIndicator>

        </ScrollViewer>

        <!-- end layout root -->
    </Grid>

</navigation:Page>

